<template>
  <ant-modal
    modalWidth="800"
    modalHeight="550"
    :visible="open"
    :modal-title="formTitle"
    :adjust-size="true"
    @cancel="cancel"
  >
    <a-form-model
      ref="form"
      :model="form"
      :rules="rules"
      slot="content"
      layout="vertical"
    >
      <a-row :gutter="32">
        <a-col :span="12">
          <a-form-model-item label="还款开始日期" prop="beginTime">
            <a-date-picker
              v-model="form.beginTime"
              valueFormat="YYYY-MM-DD"
              :show-today="true"
              placeholder="选择日期"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="贷款方式" prop="loanType">
            <a-select
              placeholder="请选择贷款方式"
              v-model="form.loanType"
              :getPopupContainer="
                (triggerNode) => {
                  return triggerNode.parentNode || document.body;
                }
              "
              style="width: 100%"
              allow-clear
            >
              <a-select-option
                v-for="(d, index) in loanTypeOptions"
                :key="index"
                :value="d.dictValue"
                >{{ d.dictLabel }}</a-select-option
              >
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="到期日期" prop="endTime">
            <a-date-picker
              v-model="form.endTime"
              valueFormat="YYYY-MM-DD"
              :show-today="true"
              placeholder="选择日期"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="还款日" prop="payDate">
            <a-date-picker
              v-model="form.payDate"
              valueFormat="YYYY-MM-DD"
              :show-today="true"
              placeholder="选择日期"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="贷款月数" prop="months">
            <a-input-number
              v-model="form.months"
              :min="0"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="本金金额" prop="principal">
            <a-input-number
              v-model="form.principal"
              :min="0"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="年利率" prop="lv">
            <a-input-number v-model="form.lv" :min="0" style="width: 100%" />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="月供金额" prop="monthPayment">
            <a-input-number
              v-model="form.monthPayment"
              :min="0"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="总还款额" prop="totalPayment">
            <a-input-number
              v-model="form.totalPayment"
              :min="0"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="总利息" prop="totalInterest">
            <a-input-number
              v-model="form.totalInterest"
              :min="0"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="是否逾期" prop="isOverdue">
            <a-radio-group v-model="form.isOverdue" button-style="solid">
              <a-radio-button
                v-for="(dict, index) in isOverdueOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio-button>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="是否结清" prop="isPayAll">
            <a-radio-group v-model="form.isPayAll" button-style="solid">
              <a-radio-button
                v-for="(dict, index) in isPayAllOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio-button>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="逾期天数" prop="overdueDays">
            <a-input-number
              v-model="form.overdueDays"
              :min="0"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="逾期说明" prop="overdueRemark">
            <a-textarea
              v-model="form.overdueRemark"
              placeholder="请输入逾期说明"
              :rows="4"
            />
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button @click="cancel"> 取消 </a-button>
      <a-button type="primary" @click="submitForm"> 保存 </a-button>
    </template>
  </ant-modal>
</template>
<script>
import BizLoanBillAddForm from "./BizLoanBillForm";
export default {
  ...BizLoanBillAddForm,
};
</script>
